///<reference path='typings/jquery/jquery.d.ts' />
///<reference path='typings/jquery.validation/jquery.validation.d.ts' />

// Module
module bgu {
	export function init() {
		// initialize all modules..
		validation.init();
	}
	module validation {
		export function init() {
			// attach invalid-form handler to form..
			$("form").bind("invalid-form.validate", function (form, validator) {
				debugger;
				$(this).find('.form-group').each(function () {
					if ($(this).find('.input-validation-error').length > 0) {
						// contains an error..
						$(this).addClass('has-error');
					} else {
						// error free..
						$(this).removeClass('has-error');
					}
				});
			});
		}
	}
}
$(function () {
	bgu.init();
});
